// @ts-ignore
import Scene from "./Poly/Scene.js";// @ts-ignore
import Frame from "./Poly/Frame.js";// @ts-ignore
import { CreateProgram } from "../tools/Utils.js";

async function _loadShader(name: String): Promise<Array<string>> {
    const vert = await import('../../public/shader/' + name + '.vert.js');
    const frag = await import('../../public/shader/' + name + '.frag.js');
    return [vert.default.getShader(), frag.default.getShader()];
}


async function LS_BackChange(obj: Scene) {
    const name = 'backChange';
    const shaderArr = await _loadShader(name);
    obj.regProgram(name, {
        program: CreateProgram(obj.gl, shaderArr[0], shaderArr[1]),
        attribs: ['a_Position', 'a_Pin'],
        uniforms: ['u_PvM4', 'u_ModelM4', 'u_PointSize', 'u_Sampler1', 'u_Sampler2', 'u_Set', 'u_texture']
    });
}
async function LS_View(obj: Scene) {
    const name = 'view';
    const shaderArr = await _loadShader(name);
    obj.regProgram(name, {
        program: CreateProgram(obj.gl, shaderArr[0], shaderArr[1]),
        attribs: ['a_Position', 'a_Pin'],
        uniforms: ['u_PvM4', 'u_ModelM4', 'u_ViewTexture', 'u_Set']
    });
}


export {
    LS_BackChange, LS_View,
}